package com.easyattendance.model;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.Check;

@Entity
@Table(name="TBL_PARENT")
public class Parent {
	
	@Id
	@Column(name="parent_id",length=15,nullable=false)
	private String parent_id;
	
	@OneToMany(mappedBy="parent")
	private Set<Student> students;
	
	@Column(name="parent_name",length=32,nullable=false)
	private String parent_name;
	
	@Column(name="parent_email_id",length=50,nullable=false)
	private String parent_email_id;
	
	@Column(name="parent_mobile_no",length=10)
	private long parent_mobile_no;
	
	@Column(name="parent_home_no",length=10)
	private long parent_home_no;
	
	@Column(name="parent_job",length=15)
	private String parent_job;
	
	@Column(name="parent_office_no",length=10)
	private long parent_office_no;
	
	@Column(name="parent_gender",length=10)
	private String parent_gender;
	
	public Parent()
	{
		
	}
	
	public Parent(String parent_id) {
		super();
		this.parent_id = parent_id;
	}

	public Parent(String parent_name, String parent_email_id) {
		super();
		this.parent_name = parent_name;
		this.parent_email_id = parent_email_id;
	}

	public Parent(String parent_id, String parent_name, String parent_email_id,
			long parent_mobile_no, long parent_home_no, String parent_job,
			long parent_office_no, String gender) {
		super();
		this.parent_id = parent_id;
		this.parent_name = parent_name;
		this.parent_email_id = parent_email_id;
		this.parent_mobile_no = parent_mobile_no;
		this.parent_home_no = parent_home_no;
		this.parent_job = parent_job;
		this.parent_office_no = parent_office_no;
		this.parent_gender = gender;
	}

	public Set<Student> getStudents() {
		return students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}

	public String getParent_id() {
		return parent_id;
	}

	public void setParent_id(String parent_id) {
		this.parent_id = parent_id;
	}

	public String getParent_name() {
		return parent_name;
	}

	public void setParent_name(String parent_name) {
		this.parent_name = parent_name;
	}

	public String getParent_email_id() {
		return parent_email_id;
	}

	public void setParent_email_id(String parent_email_id) {
		this.parent_email_id = parent_email_id;
	}

	public long getParent_mobile_no() {
		return parent_mobile_no;
	}

	public void setParent_mobile_no(long parent_mobile_no) {
		this.parent_mobile_no = parent_mobile_no;
	}

	public long getParent_home_no() {
		return parent_home_no;
	}

	public void setParent_home_no(long parent_home_no) {
		this.parent_home_no = parent_home_no;
	}

	public String getParent_job() {
		return parent_job;
	}

	public void setParent_job(String parent_job) {
		this.parent_job = parent_job;
	}

	public long getParent_office_no() {
		return parent_office_no;
	}

	public void setParent_office_no(long parent_office_no) {
		this.parent_office_no = parent_office_no;
	}

	public String getGender() {
		return parent_gender;
	}

	public void setGender(String gender) {
		this.parent_gender = gender;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((parent_email_id == null) ? 0 : parent_email_id.hashCode());
		result = prime * result
				+ ((parent_name == null) ? 0 : parent_name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Parent other = (Parent) obj;
		if (parent_email_id == null) {
			if (other.parent_email_id != null)
				return false;
		} else if (!parent_email_id.equals(other.parent_email_id))
			return false;
		if (parent_name == null) {
			if (other.parent_name != null)
				return false;
		} else if (!parent_name.equals(other.parent_name))
			return false;
		return true;
	}
	
	

}
